
//
// 101116 - AH - Created.
// 101119 - AH - Java doc. included. But with todos.
// 101128 - AH - Renamed from ResourceTablePanel.
//

package org.soekrat.gui.swing.chat;

import java.awt.BorderLayout;
import java.util.List;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import org.soekrat.AttributeObject;
import org.soekrat.engine.Soekrat2Engine;

/**
 * <p>
 *   TODO
 * </p>
 * @author Arne Halvorsen (AH)
 * @author Laetitia Le Chatton (LLC)
 */
@SuppressWarnings("serial")
public final class ResourceTalkTablePanel extends JPanel 
{
  private final ResourceTalkTableModel m_model;
  
  private final JTable m_table=new JTable();
  
  /**
   * <p>
   * </p>
   * @param engine The engine the UI interfaces to.
   */
  public ResourceTalkTablePanel(Soekrat2Engine engine)
  {
    if (engine==null)
    {
      throw new NullPointerException("engine");
    }
    
    m_model=new ResourceTalkTableModel(engine);
    m_table.setModel(m_model);
    
    setLayout(new BorderLayout());
    
    add(new JScrollPane(m_table));
  }
  
  public void setResources(List<AttributeObject> resources)
  {
    m_model.addResources(resources);
  }
  
}
